<html>
<head><meta charset="utf-8"><title>Completions Refactoring · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Completions.20Refactoring.html">Completions Refactoring</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="240354328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Completions%20Refactoring/near/240354328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eduardo Canellas <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Completions.20Refactoring.html#240354328">(May 26 2021 at 16:43)</a>:</h4>
<p>Hello, I'm new to the codebase and I've been fixing some issues involving completions.</p>
<p>I think the code there may need some refactoring. Currently, the <code>completions</code> entry point calls a dozen of different completions methods and each of them check if they should apply completions or not.</p>
<p>I thought about removing those code checks from these functions and, instead of always calling all of them, just call the ones which are needed based on the cursor position on the document. Does anyone have suggestions about it? <span aria-label="happy" class="emoji emoji-1f600" role="img" title="happy">:happy:</span></p>



<a name="240356638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Completions%20Refactoring/near/240356638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Completions.20Refactoring.html#240356638">(May 26 2021 at 16:59)</a>:</h4>
<p>there are some things that could be improved there, but it's intentional that each completion knows by itself where it applies</p>



<a name="240357160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Completions%20Refactoring/near/240357160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Completions.20Refactoring.html#240357160">(May 26 2021 at 17:02)</a>:</h4>
<p>^ I believe its easier to oversee the way it is right now</p>



<a name="240357414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Completions%20Refactoring/near/240357414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Completions.20Refactoring.html#240357414">(May 26 2021 at 17:04)</a>:</h4>
<p>Though we do want to refactor the <code>CompletionContext</code> somewhat I believe, it currently has a lot of "random" different fields. Looks a bit unwieldy to me at least and is something I wanted to look into the coming week.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>